package com.nut.lmsc.api.admin;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.nut.lmsc.api.req.CircleShopQueryReq;
import com.nut.lmsc.common.Result;
import com.nut.lmsc.entity.CircleShop;
import com.nut.lmsc.service.CircleShopService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Set;

@Slf4j
@RestController
@RequestMapping("/admin/circleShop")
public class CircleShopController {

    @Autowired
    private CircleShopService circleService;

    @GetMapping("/listPage")
    public Result<IPage<CircleShop>> listPage(CircleShopQueryReq req) {
        return circleService.listPage(req);
    }

    @GetMapping(value = "/{id}")
    public Result<CircleShop> detail(@PathVariable Integer id) {
        return circleService.getById(id);
    }

    @PostMapping
    public Result add(@RequestBody CircleShop circle) {
        return circleService.add(circle);
    }

    @PutMapping
    public Result update(@RequestBody CircleShop circle) {
        return circleService.updateById(circle);
    }

    @DeleteMapping
    public Result delete(@RequestBody Set<Integer> ids) {
        return circleService.deleteByIds(ids);
    }

}